package com.xinqi.modules.homework.homework.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xinqi.common.mybatis.data.entity.BaseEntity;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 实体层
 *
 * @author: system
 * @date: 2023/03/09
 */
@Setter
@Getter
@TableName("co_course_homework_student_log")
public class CourseHomeworkStudentLogEntity extends BaseEntity {
    /**
     * 班级ID (统计所需)
     */
    @TableField(value = "class_id")
    private Long classId;
    /**
     * 课程内容ID
     */
    @TableField(value = "content_id")
    private Long contentId;
    /**
     * 学生ID
     */
    @TableField(value = "student_id")
    private Long studentId;
    /**
     * 是否已读
     */
    @TableField(value = "is_read")
    private Integer isRead;
    /**
     * 提价记录ID
     */
    @TableField(value = "record_id")
    private Long recordId;
    /**
     * 作业打分
     */
    @TableField(value = "student_score")
    private BigDecimal studentScore;
    /**
     * 是否已阅 0否 1是
     */
    @TableField(value = "is_marked")
    private Integer isMarked;
    /**
     * 提交次数
     */
    @TableField(value = "hand_times")
    private Integer handTimes;
    /**
     * 提交次数
     */
    @TableField(value = "hand_time")
    private LocalDateTime handTime;
    /**
     * 提交次数
     */
    @TableField(value = "hand_relationship")
    private String handRelationship;
    /**
     * 催交次数
     */
    @TableField(value = "calls")
    private Integer calls;
    /**
     * 催交最后一次时间
     */
    @TableField(value = "call_time")
    private LocalDateTime callTime;
    /**
     * 打回次数
     */
    @TableField(value = "repulse_total")
    private Integer repulseTotal;
    /**
     * 是否分享 0 否 1是
     */
    @TableField(value = "share")
    private Integer share;
    /**
     * 分享理由
     */
    @TableField(value = "sharetitle")
    private String sharetitle;
    /**
     * 1分享,已批阅的才能看到
     */
    @TableField(value = "is_reviewed")
    private Integer isReviewed;
    /**
     * 是否匿名分享 0 否 1是
     */
    @TableField(value = "anonymous")
    private Integer anonymous;
    /**
     * 学生作业(0未提交,1已提交,2被打回, 3已阅, 4已批 )
     */
    @TableField(value = "task_status")
    private Integer taskStatus;
    /**
     * 是否有新提交 0否 1是
     */
    @TableField(value = "hand_status")
    private Integer handStatus;
    /**
     * 作业提交状态 1按时交 2超时交
     */
    @TableField(value = "submit_status")
    private Integer submitStatus;
    /**
     * 批阅次数
     */
    @TableField(value = "marked_num")
    private Integer markedNum;
    /**
     * 是否参与 0 否 1是
     */
    @TableField(value = "is_partake")
    private Integer isPartake;
    /**
     * 作业循环第几轮
     */
    @TableField(value = "times")
    private Integer times;


    @TableField(exist = false)
    private String repulseReason;

    @Override
    public int hashCode() {
        int result = 17;
        result = 31 * result + (int) (contentId ^ (contentId >>> 32));
        result = 31 * result + (int) (studentId ^ (studentId >>> 32));
        result = 31 * result + (times == null ? 1 : times);
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }

        CourseHomeworkStudentLogEntity that = (CourseHomeworkStudentLogEntity) obj;
        return Objects.equals(this.getId(), that.getId()) || Objects.equals(contentId, that.contentId) &&
                Objects.equals(studentId, that.studentId) &&
                Objects.equals(times, that.times);
    }

}
